import React from 'react';
import { useParams } from 'react-router-dom';
import { ChapterList } from './ChapterList';
import { books } from '../data/books';

export const ChapterListWrapper: React.FC = () => {
  const { bookId } = useParams();
  const book = books.find(b => b.id === bookId);
  
  if (!book) {
    return <div className="p-6">Book not found</div>;
  }

  return <ChapterList bookId={book.id} chapters={book.chapters} />;
}; 